package com.jxm.bootstudy.listener;

import com.jxm.bootstudy.pojo.User;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.context.ApplicationEvent;

import java.time.Clock;

/**
 * @Author: jxm
 * @Description: 自定义事件
 * 自定义事件需要继承 ApplicationEvent 对象，在事件中定义一个 User 对象来模拟数据，构造方法中将 User 对象传进来初始化
 * @Date: 2024-1-5 15:12
 * @Version: 1.0
 */
@Getter
@Setter
public class MyEvent extends ApplicationEvent {

    private User user;

    public MyEvent(Object source, User user) {
        super(source);
        this.user = user;
    }
}
